11 typedef vector
<vector
<char> > matrix
;
20 void match(const string
&s
){
22 for (int i
=0; i
<n
; ++i
){
23 assert(e
[pos
++] == s
[i
]);
27 void print(const matrix
&a
){
28 for (int i
=0; i
<a
.size(); ++i
){
29 for (int j
=0; j
<a
[i
].size(); ++j
){
38 matrix
turn(const matrix
&t
){
40 for (int j
= 0; j
< t
[0].size(); ++j
){
41 r
.push_back(vector
<char>());
42 for (int i
= t
.size()-1; i
>= 0; --i
){
43 r
.back().push_back(t
[i
][j
]);
47 for (int i
=0; i
<r
.size(); ++i
){
48 for (int j
= 0; j
<r
[i
].size(); ++j
){
49 if (r
[i
][j
] == '/') r
[i
][j
] = '\\';
50 else if (r
[i
][j
] == '\\') r
[i
][j
] = '/';
51 else if (r
[i
][j
] == '-') r
[i
][j
] = '|';
52 else if (r
[i
][j
] == '|') r
[i
][j
] = '-';
58 matrix
sew(matrix x
, const matrix
&y
){
59 if (x
.size() != y
.size()){
63 for (int i
=0; i
<y
.size(); ++i
){
64 for (int j
=0; j
<y
[i
].size(); ++j
){
65 x
[i
].push_back(y
[i
][j
]);
76 }else if (e
[pos
] == 'B'){
79 }else if (e
[pos
] == 't'){
82 if (::error
) return empty
;
85 }else if (e
[pos
] == 's'){
88 if (::error
) return empty
;
91 if (::error
) return empty
;
99 a
= vector
<vector
<char> >(2, vector
<char>(2, '/'));
104 b
= vector
<vector
<char> >(2, vector
<char>(2, '-'));
108 empty
= vector
<vector
<char> >();
120 while (cin
>> c
&& c
!= ';'){
126 cout
<< "Quilt " << quiltNo
++ << ":" << endl
;
129 cout
<< "error" << endl
;